jQuery.extend({
    centerOnWindowResize:function(elem){
        if(elem){
            var height = $(document).height();
            var width = $(document).width();
            var left = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : 0;
            var top = document.documentElement.scrollTop ? document.documentElement.scrollTop : 0;
            elem.css("left",Math.max((left + (width - elem.width()) / 2), 0) + 'px');
            elem.css("top",Math.max((top + elem.height()), 0) + 'px');
        }
    },
    showEmptyWarningDialog:function(msg,callback){
        var overlay = $("<div></div>").attr("id","overlay").appendTo(document.body);
        var dialog = $("<div></div>").addClass("dialog").appendTo(document.body);
        var title = $("<div></div>").addClass("title").appendTo(dialog);
        var tip = $("<span>提示</span>").appendTo(title);
        var close = $("<a href='javascript:void(0)' ><img src='/medias/image/gtk_close.png'/></a>").click(function(){
            dialog.remove()
            overlay.remove()
        }).appendTo(title);
                    
        var warningMsgDiv = $("<div></div>").addClass("warningmsg").appendTo(dialog);
        var warningImg = $('<span><img  src="/medias/image/gtk_dialog_warning_panel.png" /></span>').appendTo(warningMsgDiv);
        var warningMsg = $("<span>"+msg+"</span>").appendTo(warningMsgDiv);
                    
        var waringActionDiv = $("<div></div>").addClass("warningaction").appendTo(dialog);
        var waringAction = $('<a href="javascript:void(0)">确定</a>').click(function(){
            dialog.remove()
            overlay.remove()
        }).appendTo(waringActionDiv);
                        
        $.centerOnWindowResize(dialog)
        dialog.draggable({
            handle:title
        });
                        
        overlay.show()
        dialog.show();
    }
})